using System;
using System.Threading.Tasks;
using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    /// <summary>
    /// 社区帖子收藏仓储接口
    /// </summary>
    public interface ICommunityPostFavoriteRepository : IRepository<CommunityPostFavorite>
    {
        /// <summary>
        /// 根据用户ID获取收藏列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>收藏列表</returns>
        Task<IEnumerable<CommunityPostFavorite>> GetByUserIdAsync(Guid userId);

        /// <summary>
        /// 根据帖子ID获取收藏列表
        /// </summary>
        /// <param name="postId">帖子ID</param>
        /// <returns>收藏列表</returns>
        Task<IEnumerable<CommunityPostFavorite>> GetByPostIdAsync(Guid postId);

        /// <summary>
        /// 检查用户是否已收藏帖子
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="postId">帖子ID</param>
        /// <returns>是否已收藏</returns>
        Task<bool> CheckUserHasFavoritedAsync(Guid userId, Guid postId);

        /// <summary>
        /// 获取用户的收藏数量
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>收藏数量</returns>
        Task<int> GetUserFavoriteCountAsync(Guid userId);

        /// <summary>
        /// 获取帖子的收藏数量
        /// </summary>
        /// <param name="postId">帖子ID</param>
        /// <returns>收藏数量</returns>
        Task<int> GetPostFavoriteCountAsync(Guid postId);

        /// <summary>
        /// 获取用户收藏的帖子列表（分页）
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>收藏的帖子列表</returns>
        Task<(IEnumerable<CommunityPostFavorite> Items, int TotalCount)> GetUserFavoritesPagedAsync(Guid userId, int pageIndex, int pageSize);
    }
}